ACG LINK
Network Load Balancer (NLB): Overview and Configuration Example
Amazon Network Load Balancer (NLB) is a highly scalable and performant load balancing service that operates at the transport layer (Layer 4) of the OSI model. It distributes incoming network traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses, within one or more availability zones. Here's a detailed overview of Amazon NLB along with a configuration example:
Features of Amazon NLB:
-
Layer 4 Load Balancing:
- Operates at the transport layer, allowing for efficient handling of TCP and UDP traffic.
-
Static IP Addresses:
- Provides a static IP address for each Availability Zone, facilitating direct communication with backend targets.
-
High Throughput and Low Latency:
- Delivers high throughput and low-latency performance for handling large volumes of traffic.
-
Support for TCP and UDP:
- Supports both TCP and UDP protocols, making it suitable for a wide range of applications.
-
Integration with AWS Services:
- Integrates seamlessly with other AWS services, such as Auto Scaling, AWS WAF (Web Application Firewall), and AWS CloudWatch.
-
Cross-Zone Load Balancing:
- Distributes traffic evenly across targets in multiple Availability Zones for improved fault tolerance.
Configuration Example:
Let's create a simple Amazon Network Load Balancer and configure it to distribute TCP traffic to backend EC2 instances using the AWS Management Console:
-
Login to AWS Console:
-
Open EC2 Console:
- Click on the "EC2" service in the console.
-
Create EC2 Instances:
- Launch EC2 instances that will serve as backend targets. Ensure they are in the same VPC and security group.
-
Open Load Balancer Console:
- Click on the "Load Balancers" section and choose "Create Load Balancer."
-
Select Network Load Balancer:
- Choose "Network Load Balancer" and click "Create."
-
Configure Load Balancer:
- Provide a name for the load balancer.
- Specify the listener configuration, such as the protocol (TCP or UDP) and port (e.g., TCP port 80).
-
Configure Availability Zones:
- Choose the Availability Zones where you want the load balancer to distribute traffic.
-
Configure Target Groups:
- Define target groups and associate EC2 instances with each group. Configure health checks for each target group.
-
Configure Security Settings (Optional):
- Optionally, configure security settings, including source IP address preservation.
-
Review and Create:
- Review the load balancer configuration and click "Create."
-
Monitor Load Balancer Creation:
- Monitor the load balancer creation process in the console until the status becomes "Active."
-
Update DNS (Optional):
- If using a custom domain, update DNS settings to point to the DNS name of the load balancer.
-
Test Load Balancer:
- Test the load balancer by accessing the DNS name or IP address. Requests should be distributed to the configured target groups.
-
Scale and Update Configuration (Optional):
- Optionally, scale the number of EC2 instances in target groups or update load balancer configuration as needed.
-
Delete Load Balancer (Optional):
- Optionally, you can delete the load balancer through the console if it's no longer needed.